package stackToQuque;

import java.util.Stack;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 东莞呵呵
 * Date:2022-05-30
 * Time:13:20
 */
public class StackToQueue {
    public Stack<Integer> stack1;
    public Stack<Integer> stack2;
    public StackToQueue() {
        this.stack1=new Stack<Integer>();
        this.stack2=new Stack<Integer>();

    }

    public void appendTail(int value) {
        stack1.add(value);
    }

    public int deleteHead() {
        if(stack2.isEmpty()){
            while(!stack1.isEmpty()){
                stack2.add(stack1.pop());
            }
        }
            return stack2.pop();
    }
}
